<include file="public@header" />
</head>
<body>
<style type="text/css">
	.aui_state_lock{
		top:50% !important;
		left: 50% !important;
		transform: translate(-50%,-50%);
	}
</style>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
	
			<li id="list"><a href="{:url('order/index')}">运营中心</a></li>
			<li><a href="{:url('order/addorder')}">订单添加</a></li>
			<li class="active" id="list"><a href="{:url('rent/index')}">收租</a></li>
			<!-- 	<li><a href="{:url('user/add')}">{:lang('ADMIN_USER_ADD')}</a></li> -->
		</ul>
		<form class="well form-inline margin-top-20 " method="post" action="{:url('rent/index')}" id="order_into">
		
		<!-- 	客户名称:
			<input type="text" class="form-control" name="customer_name" style="width: 120px;" value="" placeholder="请输入场地名">
			业务员名称:
			<input type="text" class="form-control" name="linkman" style="width: 120px;" value="" placeholder="请输入业务员名称">
			时间:
			<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
			value="{$start_time|default=''}"
			style="width: 140px;" autocomplete="off">-
			<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
			value="{$end_time|default=''}"
			style="width: 140px;" autocomplete="off"> &nbsp; &nbsp; -->
			交付状态:
			<select class="form-control" name="status" style="width: 140px;">
				<option value=''>交付状态</option>
				<option value="2" <if condition="$status eq 2">selected</if>>已交付</option>
				<option value="1" <if condition="$status eq 1">selected</if>>未交付</option>
			
			</select> &nbsp;&nbsp;



			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:url('rent/index')}">清空</a>
		<!-- 	<input type="hidden" name="" value="{$order_into}"> -->
		</form>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th width="50">ID</th>
					<th>空间名</th>
					<th>客户名</th>
					<th>类型</th>
					<th>单价</th>
					<th>数量</th>
					<th>租金总额</th>
					<th>支付方式</th>
					<th>费用周期</th>
					<th>状态</th>
					<th>实际应收</th>
					<th width="130">操作</th>
				</tr>
			</thead>
			<tbody>
				<!-- 	<php>$user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));</php> -->
				
				<foreach name="list" item="vo">
					<tr>
					    <input type="hidden" name="id" value="{$vo.id}">
						<td>{$vo.id}</td>
						<td><?php echo get_space_name($vo['space_type'],$vo['space_id']); ?></td>
						<td><?php echo get_customer_name($vo['customer_id']); ?></td>
						<td><if condition="$vo['space_type'] eq 1">园区/空间<else/>场地</if></td>
						<td>{$vo.price}</td>
						<td>{$vo.amount}</td>
						<td>{$vo.sum_price}</td>
						<td>
						<switch name="vo.payway_id">
							<case value="1">年 </case>
							<case value="2">半年</case>
							<case value="3">季</case>
							<case value="4">月</case>
							<case value="5">次</case>
							<default/>暂无
						</switch>





						</td>
						<td>{$vo.cycle_time}</td>
						<td>
						<switch name="vo.status">
							<case value="1">未交</case>
							<case value="2">已交</case>
							<default/>暂无
						</switch>



						</td>
						<td>{$vo.round_price}</td>
					
						
						<td>
							<a class='pay' id="{$vo.id}">已交</a>
							|
							<a class='del' id="{$vo.id}">未交</a>
						</td>


					</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
<script>
	$(function(){
		order_into="{$order_into}";
		if(order_into){
			$("#order_into").css('display','none');
		}
	})
	$(".del").click(
	    function(){
	    if(confirm("是否确认该租金未交付")){
	    	    var id=$(this).attr("id");
	    	    $.post("{:url('payStatus')}",
	    		{id:id},
	    		function(data,status){

	    			location.href="{:url('index')}";
	    		});
	    }
		
		
	    }
	);
	$(".pay").click(
	    function(){
	    if(confirm("是否确认该租金已交付")){
	    	    var id=$(this).attr("id");
	    	    $.post("{:url('payStatus')}",
	    		{id:id,status:2},
	    		function(data,status){

	    			location.href="{:url('index')}";
	    		});
	    }
		
		
	    }
	);

	



</script>